home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / tlx_sq21.zip / PCB.SLT < prev    next >
Text File  |  1992-03-20  |  15KB  |  437 lines

  1. //-----------------------------------------------------------
  2. // PCB.SL?    Telix script for logon to a PCBoard BBS.
  3. //
  4. // This script is normally called from the script LOGON.SLC.
  5. //
  6. // Please look at the comments through the whole file, and modify to
  7. // suit your needs, BEFORE you use it. Then recompile with CS PCB.
  8. //-----------------------------------------------------------
  9.  
  10. // If you have suggestions for improving this script, please suggest
  11. // improvements to me via old-fashioned snail-mail to:
  12.  
  13. // Author:  Inge Vabekk
  14. //          Hamangskogen 108
  15. //          N-1300 SANDVIKA
  16. //          NORWAY
  17. //          tel. (472) 546 396
  18.  
  19. str thisBBStype[]="PCB"        // Must be PCB to work.
  20.    ,line      [80]             // Temporary line.
  21.    ,logfile   [64]             // Log file name.
  22.    ,catfile   [32]             // Catalog file name.
  23.    ,filelist  [12]             // Name of file list.
  24.    ,Sdoor      [2]             // and door to open
  25.    ,myprot     [2]             // My protocol
  26.    ,hisprot    [2]             // and BBS's prot. character.
  27.    ,command   [10]             // Current command prompt.
  28.                                // For the Global storage:
  29.    ,global      []="GLOBAL"    // Global script.
  30.    ,PutLine     []="PUTLINE"   // PutLine script.
  31.    ,bbstype     []="BTYPE"     // BBS type.
  32.    ,short       []="SHORT"     // Short BBS name.
  33.    ,Cprot       []="CPROT"     // Current protocol.
  34.    ,Hprot       []="HPROT"     // "His" protocol.
  35.    ,passw       []="PASSW"     // Current password.
  36.    ,version     []="BBSVER"    // Current PCB version.
  37.    ,prompt      []="PROMPT"    // Current command prompt.
  38.    ,conf        []="CONF"      // Current conference.
  39.    ,mscript     []="MDOOR"     // Name of mail door/script.
  40.    ,mailup      []="MAILUP"    // Default PCB mail upload script
  41.    ,update      []="UPDATE$"   // Name of update program.
  42.    ;     
  43.  
  44. int tol = 200                  // No activity for 20 sec.
  45.    ,tmark                      // makes script time out.
  46.    ,stat
  47.    ,door                       // Door number.
  48.    ,InDoor                     // TRUE if in door.
  49.    ,mega                       // MegaMail door.
  50.    ,MarkM                      // MarkMail door.
  51.    ,dbdoor                     // Dial-Back door.
  52.    ,BBSver                     // PCB version
  53.    ,first
  54.    ,error                      // General error indicator
  55.    ,cm                         // Trig on Command prompt
  56.    ,pm                         // Trig on "Personal Mail"
  57.    ,pw                         // Trig on password.
  58.    ,Enter=13                   // Code for CR.
  59.    ;
  60.  
  61. //-----------------------------------------------------------
  62. // PCBOARD logon script entered here.
  63. //-----------------------------------------------------------
  64.  
  65. main ()
  66. {
  67. int i, m;
  68.  
  69.   first = 1;                             // First time on.
  70.   entry();                               // Update colors & status bar.
  71.  
  72. // Only if online.
  73.  
  74.   if (!carrier())  
  75.   { failtone();
  76.     status_wind ("T²: THIS SCRIPT ONLY WORKS IF YOU'RE ONLINE!",20);
  77.     return (-1);
  78.   }
  79.  
  80.   read (bbstype,line);                   // Get BBS type. 
  81.   if (line != thisBBStype)  
  82.   { wrongBBS();                          // Doesn't match script!
  83.     return (-1);
  84.   }
  85.  
  86.   command = "Command";                   // Set code for command prompt.
  87.   write (prompt,command);                // Start tracking NOW.
  88.  
  89.   pw = track ("ill echo)?", 0);          // Track password.
  90.   pm = track ("ter)=yes?", 0);           // Scan for personal mail?
  91.   cm = track (command,   0);             // Command.
  92.  
  93. //printsc ("pw = "); printn (pw); prints (" ill echo)?");
  94. //printsc ("pm = "); printn (pm); prints (" ter)=yes?");
  95. //printsc ("cm = "); printn (cm); prints (" command");
  96.  
  97.   read (version,line);
  98.   BBSver = subchr (line,0);              // Get PCB version.
  99.   write (conf,"Main Board");             // Always starts in this conf.
  100.  
  101.   read (Cprot,myprot);
  102.   if (myprot=="1")
  103.     hisprot = "O";
  104.   else if (myprot=="E")                  // ymodEm/g
  105.     hisprot = "G";
  106.   else if (myprot=="D")                  // external Dsz
  107.     hisprot = "Z";
  108.   else
  109.     hisprot = myprot;
  110.   write (Hprot,hisprot);                 // Write BBS protocol.
  111.  
  112.   read (passw,line);                     // Get password.
  113. // ****** REMEMBER: Don't use PutLine here ! *****
  114.   cputs (line);
  115.   if (BBSver < 100)                      // If entry from ProLogon,
  116.   { cputs (";");                         // add a semicolon, 
  117.     cputs (Sdoor);                       // DOOR number,
  118.     cputs (";NS");                       // NS
  119.   }
  120.   terminal();
  121.   cputs ("^M");                          // and ENTER.
  122.  
  123.   if (get_baud() < 4800)                 // Speed below 4800?
  124.   { delay (2);                           // Delay, then terminate
  125.     cputs ("^K");                        // long output with CTRL-K.
  126.   }
  127.  
  128.   InDoor = BBSver < 100;                 // Entry from ProLogon:
  129.   if (BBSver > 144)                      // For PCBoard < 14.5 we should
  130.   { door = 0;                            // be in door already.
  131.     InDoor = 1;
  132.     i = strposi(_entry_name,"D:",0);     // Find door number from name.
  133.     if (i > 0) 
  134.     { substr (_entry_name,i+2,2,Sdoor);  // Copy max. 2 characters.
  135.       door = stoi(Sdoor);                // Find door number.
  136.       if (door != 0) InDoor = 0;
  137.     }
  138.   }
  139.   else                                   // ProLogon or PBCoard < 14.5:
  140.   { Sdoor = "1";                         // Door 1 is default.
  141.     door = 1;
  142.   }
  143.  
  144. // Start tracking incoming text. For ease of reading and programming,
  145. // this is split into different sections.
  146. //-----------------------------------------------------------
  147.  
  148.   error = 1;
  149.   SECTION1();                            // Run section one.
  150.   release();
  151.   if (first) first = GetPrompt();        // Get prompt if I didn't get it.
  152.  
  153. fail:
  154.   if (!carrier()) error = 1;
  155.   if (error) return (-1);
  156.  
  157.   setchr (line,0,BBSver);                // Update PCB version.
  158.   setchr (line,1,0);
  159.   write (version,line);
  160.  
  161.   if (dbdoor)
  162.   { error = call ("DialBack");           // Chain to the DialBack script.
  163.     if (error) goto fail;                // Can't continue. 
  164.   }
  165.   line=mailup;                           // ASCII upload mail.
  166.   if (MarkM)                             // Check which door.
  167.     line="MARKMAIL";                     // Chain to the MarkMail script.
  168.   else if (mega)
  169.     line="MEGAMAIL";                     // Chain to the MegaMail script.
  170.   write (mscript,line);                  // Write name of mail script.
  171.   return (0);
  172. }
  173.  
  174. //-----------------------------------------------------------
  175. // Section 1: Check any happenings before first command.
  176. //-----------------------------------------------------------
  177.  
  178. SECTION1()
  179. {
  180. int c                         // Single character.
  181.    ,lfs
  182.    ,novice                    // For tracking:
  183.    ,more                      // "More" prompt received if TRUE.
  184.    ,he                        // Help needed
  185.    ,en                        // ENTER to continue
  186.    ,ns                        // Non-stop request.
  187.    ,mo                        // More?
  188.    ,lf                        // Linefeed.
  189.    ,dr1, dr2, dr3, dr4        // various doors.
  190.    ;
  191.  
  192.   dr2=dr3=dr4=mega=MarkM=dbdoor=more=novice=0;     // Preset some.
  193.  
  194.   dr1 = track ("ProDoor ",0);            // ZIPM mail.
  195. //printsc ("dr1 = "); printn (dr1); prints (" ProDoor");
  196.   if (door > 1)
  197.   { dr2 = track ("M a r k M",0);         // MarkMail.
  198.     dr3 = track ("ing MEGA,",0);         // Megamail.
  199.     dr4 = track ("DB_DOOR ",0);          // Dial-Back door.
  200. //printsc ("dr2 = "); printn (dr2); prints (" M a r k M");
  201. //printsc ("dr3 = "); printn (dr3); prints (" ing MEGA,");
  202. //printsc ("dr4 = "); printn (dr4); prints (" DB_DOOR ");
  203.   }
  204.   mo = track ("p, More?",0);             // More?
  205.   en = track ("r to cont",0);            // Enter to continue
  206.   ns = track ("non-stop",0);             // Non-stop request?
  207.   he = track (" for help",0);            // Novice.
  208.   lf = track ("^J",0);                   // Long list? (trig on LF)
  209. //printsc ("